//考场范围
function partition() {
	completecut = 0;
	if (($('#randomtable1').length > 0) && ($('#outtable').length > 0)) {
		var str = $('#datainput').val();
		var flags = /^[0-9 -]+$/.test(str);
		if (str == '') {
			for (var j = 1; j <= rightlist.length; j++) {
				totals.push(j);
			}
		} else if (str == '输入考场序号10-20 30') {
			for (var j = 1; j <= rightlist.length; j++) {
				totals.push(j);
			}
		} else if (flags == false) {

			swal("OMG!", "请检查输入的格式", "error");
			completecut = 1;
			return;
		} else {
			arr = str.split(' ');
			console.log(arr)
			for (var i = 0; i < arr.length; i++) {
				var test = /^\d+$/.test(arr[i]);
				if (test == true) {
					if (parseInt(arr[i]) <= 0) {
						swal("OMG!", "请保证数字大于0!", "error");
						completecut = 1;
						return;
					} else {
						totals.push(parseInt(arr[i]));
					}
				} else {
					if (arr[i].indexOf("-") != -1 && arr[i].substr(0, 1) != '-') {
						var crr = arr[i].split("-");
						if (crr.length == 2) {
							var a = crr[0];
							var b = crr[1];
							crr[0] = a < b ? a : b;
							crr[1] = a < b ? b : a;
							for (var j = parseInt(crr[0]); j <= parseInt(crr[1]); j++) {
								if (j <= 0) {
									swal("OMG!", "请保证数字大于0!", "error");
									completecut = 1;
									return;
								} else {
									totals.push(j);
								}
							}
						} else {

							swal("OMG!", "请检查输入数据的格式", "error");
							completecut = 1;
							return;
						}
					} else {
						totals = new Array();
						clearInterval(interval);
						interval = null;

						swal("OMG!", "请检查输入的格式,两组数之间是否有空格,是否大于0，是否超出长度!", "error");
						completecut = 1;
						return;

					}
				}
			}
		}
		Toreorder();
		var rightlength = rightlist.length;
		console.log(brr[brr.length - 1]);
		if ((brr[brr.length - 1] > rightlength)) {
			swal("OMG!", "请检查考场范围!", "error");
			completecut = 1;
			totals = [];
		} else {
			totals = [];
			randomtables();
		}
	} else {
		swal("OMG!", "请添加考场信息!", "error");
		return;
	}
}
